package com.vision.sales.cl.data;


import java.util.Date;

import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
import com.vision.core.cm.db.data.Company;
import com.vision.sales.cm.data.TransactionType;
import com.vision.sales.cm.db.data.Customer;
import com.vision.sales.cm.db.data.Product;
import com.vision.sales.cm.db.data.Salesman;
import com.vision.sales.cm.db.data.TransactionEntry;

/**
 * 
 * @author Mark
 *
 */
public interface TransactionEntryProperties extends PropertyAccess<TransactionEntry> {
	
	public static final TransactionEntryProperties INSTANCE = GWT.create(TransactionEntryProperties.class);
	
	ModelKeyProvider<TransactionEntry> KEY = new ModelKeyProvider<TransactionEntry>() {
		@Override
		public String getKey(TransactionEntry item) {
			return item.getCompany().getId() + "-" + item.getDate() + "-" + item.getTransactionId() + "-" + item.getType();
		}
	};
	
	@Path("transactionRefNo")
	LabelProvider<TransactionEntry> nameLabel();

	@Path("company.code")
	ValueProvider<TransactionEntry, String> companyCode();
	ValueProvider<TransactionEntry, Company> company();
	
	ValueProvider<TransactionEntry, Date> date();
	
	ValueProvider<TransactionEntry, TransactionType> type();
	@Path("type.displayText")
	ValueProvider<TransactionEntry, String> typeText();
	
	ValueProvider<TransactionEntry, Long> transactionId();
	
	ValueProvider<TransactionEntry, String> transactionRefNo();
	
	@Path("customer.code")
	ValueProvider<TransactionEntry, String> customerCode();
	ValueProvider<TransactionEntry, Customer> customer();
	
	@Path("salesman.code")
	ValueProvider<TransactionEntry, String> salesmanCode();
	ValueProvider<TransactionEntry, Salesman> salesman();
	
	@Path("product.code")
	ValueProvider<TransactionEntry, String> productCode();
	ValueProvider<TransactionEntry, Product> product();
	
	ValueProvider<TransactionEntry, Double> debit();
	ValueProvider<TransactionEntry, Double> credit();
	ValueProvider<TransactionEntry, Double> balance();
	
}